package com.cn.sl.server.common.dto

import com.fasterxml.jackson.annotation.JsonIgnore
import io.swagger.v3.oas.annotations.media.Schema

@Schema(description = "分页查询参数")
open class PageQueryDto(
    @field:Schema(description = "查询页数")
    open val page: Int = 1,
    @field:Schema(description = "pageSize")
    open val pageSize: Int = 50,
    @field:Schema(description = "字段排序")
    open val sorts: List<PageSortDto> = arrayListOf(),
    @field:Schema(description = "单字段排序")
    open val sort: PageSortDto? = null,
) {
    /**
     * 获取开始查询的记录数
     *
     * @return int
     */
    @get:JsonIgnore
    val col: Int
        get() = (page - 1) * pageSize
}